﻿using System;
using System.Data;
using System.Web.UI;

namespace ListView的使用
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BindListView();
            }
        }

        protected void BindListView()
        {
            string commandText =
                @"SELECT ItemID, Title, Price, Image FROM Items";
            DataSet dataSet = SqlHelper.GetDataSetBySqlCommand(commandText, SqlHelper.GetConnection());
            lvwItems.DataSource = dataSet;
            lvwItems.DataBind();
        }
    }
}